/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fyp.admin;

import java.sql.*;

/**
 *
 * @author Mike
 */
public class ArtistDA {
    // DB Connection object
    Connection c = null;
    
    // getConnection to DB
    private Connection getConnection(){
        String driver = ("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/fypdb";
        
        try{
            // Load database driver if not already loaded.
            Class.forName(driver);

            // Establish network connection to database.
            c = DriverManager.getConnection(url, "root", "");
            
            return c;
        } catch (ClassNotFoundException cnfe) {
            System.err.println("Error loading driver: " + cnfe);
            return null;
        } catch (SQLException sqle) {
            System.err.println("Error connecting: " + sqle);
            return null;
        }
    }
}
